package actions;

//~--- non-JDK imports --------------------------------------------------------

import beans.MergeTopicsFormBean;
import beans.SplitFormBean;

import dto.Topics;

import moderator.ModeratorControlPanel;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

//~--- JDK imports ------------------------------------------------------------



import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SplitTopic extends org.apache.struts.action.Action {
    public SplitTopic() {}

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        ActionForward         forward = new ActionForward();
        SplitFormBean         topic   = (SplitFormBean) form;
        ModeratorControlPanel modCP   = new ModeratorControlPanel();
        Topics                t       = new Topics();

        t.setTopicid(topic.getTopicId());

//      boolean done = 
        modCP.split(t, topic.getSplitDate());

//      if(done)
        forward = mapping.findForward("OperationSuccessful");

//      else
//            forward = mapping.findForward("Operationfailed");
        return forward;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
